Skip to content

[codex] Add reparent E2E scenarios#530

Closed
edgars-avotins wants to merge 17 commits into
mainfrom
codex/protofleet-reparent-e2e-scenarios
Closed

[codex] Add reparent E2E scenarios#530
edgars-avotins wants to merge 17 commits into
mainfrom
codex/protofleet-reparent-e2e-scenarios

Conversation

@edgars-avotins

Copy link
Copy Markdown
Contributor

Reviewable diff: +0/-0 across 0 files (excludes generated, test, and story files).

Summary

This PR adds ProtoFleet E2E coverage for three reparent workflows that operators can trigger from the existing Fleet surfaces: moving a rack to a building, assigning a miner to a site, and assigning a miner to a rack. The spec verifies the network requests and resulting UI state for each flow, while also handling the local dev configuration where multi-site Fleet tabs may be disabled and the legacy sites/settings routes remain the stable management surface.

How it works

The new Playwright spec provisions temporary sites, buildings, and racks as needed, performs the reparent action from the Racks or Miners tab, then validates the request payload sent to the backend and the resulting placement state visible in the app. For local environments where VITE_MULTI_SITE_ENABLED is off, setup and cleanup use the legacy /settings/sites and related site-scoped building surfaces, but the user actions under test still happen from the Fleet Racks and Miners tabs.

Diagrams

flowchart LR
  A["Create temporary site/building/rack state"] --> B["Open Fleet Racks or Miners tab"]
  B --> C["Trigger reparent action from row/menu UI"]
  C --> D["Select target in ParentPickerModal"]
  D --> E["Capture assign request payload"]
  E --> F["Assert resulting placement in UI"]
  F --> G["Clean up temporary state"]
Loading

Areas of the code involved

Area / package / file What changed Why it matters for review
client/e2eTests/protoFleet/spec/minersReparent.spec.ts Added a new Playwright spec covering rack-to-building, miner-to-site, and miner-to-rack reparent flows, plus environment-aware setup/cleanup helpers. This is the full behavior change in the PR; reviewers can focus on scenario selection, assertions, and local-environment compatibility.

Key technical decisions & trade-offs

  • The spec validates request payloads and final visible state instead of depending on transient toast copy, because the local legacy surfaces do not render every success toast consistently.
  • Setup and cleanup branch between Fleet multi-site pages and legacy settings pages so the scenarios stay runnable in both local dev modes instead of requiring a flag-specific environment.
  • The miner fixture selection prefers an unracked paired miner when available, but falls back to any visible miner so the scenarios remain executable against the current local seed data.

Testing & validation

  • ./node_modules/.bin/eslint e2eTests/protoFleet/spec/minersReparent.spec.ts
  • PW_UI_NO_DEPS=1 npx playwright test spec/minersReparent.spec.ts --project=desktop
  • Not covered: mobile/browser-matrix runs and the broader ProtoFleet E2E suite.

@github-actions github-actions Bot added javascript Pull requests that update javascript code client labels Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated security-focused code review generated by Codex.
It should be used as a supplementary check alongside human review.
False positives are possible - use your judgment.

Scope summary

  • Reviewed pull request diff only (0ef9ee230e6aac5fd94746ad1af8e332af6e7abd...4100180649e1af53a650d70fb83e74383609e2f0, exact PR three-dot diff)
  • Model: gpt-5.5

💡 Click "edited" above to see previous reviews for this PR.


Review Summary

Overall Risk: NONE

Findings

No findings.

Notes

The scoped diff only changes ProtoFleet Playwright E2E fixtures, page objects, helpers, and a new minersReparent.spec.ts. I did not find changes to production auth, RPC handlers, SQL, protobufs, plugins, infrastructure, miner command paths, or pool configuration logic.

I reviewed .git/codex-review.diff as the authoritative scope. I did not run the E2E suite in this read-only environment.


Generated by Codex Security Review |
Triggered by: @edgars-avotins |
Review workflow run

@edgars-avotins edgars-avotins force-pushed the codex/protofleet-reparent-e2e-scenarios branch from 1447f24 to 2691f13 Compare June 25, 2026 08:40
@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Jun 25, 2026
@edgars-avotins edgars-avotins marked this pull request as ready for review June 26, 2026 10:34
@edgars-avotins edgars-avotins requested a review from a team as a code owner June 26, 2026 10:34
Copilot AI review requested due to automatic review settings June 26, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new ProtoFleet Playwright E2E coverage for “reparent” workflows (rack → building, miner → site, miner → rack), plus a small page-object tweak and a CI workflow adjustment to run the new spec without setup-project dependencies.

Changes:

  • Added minersReparent.spec.ts with three end-to-end reparent scenarios, including setup/cleanup and request-payload assertions.
  • Updated RacksPage.clickSaveRack() to scope the “Save” click to the full-screen modal.
  • Updated the ProtoFleet E2E GitHub Actions workflow to set PW_UI_NO_DEPS=1 for the new spec shard.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
client/e2eTests/protoFleet/spec/minersReparent.spec.ts New Playwright spec covering three reparent operator workflows with request + UI assertions.
client/e2eTests/protoFleet/pages/racks.ts Makes rack “Save” interaction more specific by scoping it to the full-screen modal.
.github/workflows/protofleet-e2e-tests.yml Skips setup project dependencies for the new spec shard via PW_UI_NO_DEPS=1.

Comment thread client/e2eTests/protoFleet/spec/minersReparent.spec.ts Outdated
Comment thread client/e2eTests/protoFleet/spec/minersReparent.spec.ts Outdated
Comment thread .github/workflows/protofleet-e2e-tests.yml Outdated
@github-actions github-actions Bot removed the github_actions Pull requests that update GitHub Actions code label Jun 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2666a50874

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +297 to +299
const continueButton = this.page.getByRole("button", { name: "Continue", exact: true });
if (await continueButton.isVisible().catch(() => false)) {
await continueButton.click();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wait for the site-move conflict dialog

When cleanup restores a miner that originally belonged to another site after the assign-to-rack scenario, the miner is still in the temporary rack/site, so AssignDevicesToSite first returns the cross-site rack conflict and renders a Continue dialog asynchronously. This immediate isVisible() check can run before that dialog appears, causing the helper to return without force-clearing the rack membership; the following cleanup then runs with the modal still open and can leave the miner/rack placement dirty. Wait briefly for either the dialog and click it, or for the picker to close, before returning.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e29e459c2c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +145 to +148
const snapshots = body.snapshots ?? body.miners ?? [];
if (snapshots.length === 0) {
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match only the visible miners request

When the Fleet layout mounts, CompleteSetup also sends ListMinerStateSnapshots requests for auth-needed/pool-needed counts before the Miners table request. This handler resolves on the first non-empty response regardless of its request filter, so in environments with any auth-required miners it can hand captureMovableMiner only those background snapshots; the later loop skips auth-required rows and throws even though the visible miners list contains valid candidates. Keep listening until the response matches the table request or the visible IPs instead of resolving on any non-empty response.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4c2f1e564

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +300 to +302
await this.clickViewList();
await this.waitForRackListToLoad({ allowEmpty: false });
return await this.getRackId(label);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle created racks beyond the first page

In orgs with more than one page of racks, the racks tab is paginated and defaults to name-ascending order, but this helper switches to list view and immediately parses the row from the current page only. A newly generated label like miner_rack_*/reparent_rack_* can sort after 50 existing racks, so getRackId(label) times out before the reparent assertions even run when the suite is pointed at a larger seeded or real fleet. Filter/search for the created label or page until it is visible before reading the id.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4100180649

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


private async selectParentPickerTarget(label: string) {
const modal = this.page.getByTestId("modal");
await modal.getByText(label, { exact: true }).click();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Page the rack picker before selecting labels

When the org has more than 50 racks, the rack ParentPicker only renders one page at a time (ParentPickerModal uses PAGE_SIZE = 50 for kind === "rack"), but this helper clicks the label on the currently visible page only. In the new miner-to-rack scenario, a freshly created miner_rack_* (or an original rack during cleanup) can sort beyond the first page, so this click times out even though the rack exists; page through the picker or filter/search before selecting the label.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants